﻿@inject IDataCacheService _dataCacheService

@if (Model.Any())
{
    <CnGalWebSite.Components.Containers.MasaTitleContainer Icon="@IconType.Edit.ToIconString()" Title="最近编辑" Class="mb-4" Collapable Outline>
     <div class="row">
         @foreach (var item in Model.Skip((CurrentPage - 1) * MaxCount).Take(MaxCount))
            {
                <div class="col-12 col-sm-6 col-md-4 col-lg-3 col-xxl-2 mb-4">
                    <CnGalWebSite.Shared.MasaComponent.Shared.Cards.Search.EntryInforViewTip BigCardStyle Model="item" />
                </div>
            }
        </div>

        @if (TotalPages > 1)
        {
            <CnGalWebSite.Components.Paginations.MasaPagination Value="@CurrentPage" Length="@TotalPages" ValueChanged="OnPageClick" />
        }

    </CnGalWebSite.Components.Containers.MasaTitleContainer>
}


@code {
    [Parameter]
    public List<EntryInforTipViewModel> Model { get; set; } = new List<EntryInforTipViewModel>();

    public StringNumber TabIndex { get; set; } = 1;

    public int MaxCount { get; set; } = 10;

    public int TotalPages => ((Model.Count - 1) / MaxCount) + 1;

    public int CurrentPage { get; set; } = 1;


    private void OnPageClick(int pageIndex)
    {
        CurrentPage = pageIndex;
        StateHasChanged();

    }
}
